<?php

use yii\db\Migration;

/**
 * Class m171206_053425_addColumnToCourse
 */
class m171206_053425_addColumnToCourse extends Migration
{
    /**
     * @inheritdoc
     */
    public function safeUp()
    {
        $this->addColumn('{{%course}}','icon',$this->string()->notNull()->defaultValue('')->comment('课程图标'));
        $this->addColumn('{{%course}}','price',$this->decimal(8,1)->notNull()->defaultValue(0)->comment('课程价格'));

    }

    /**
     * @inheritdoc
     */
    public function safeDown()
    {
        $this->dropColumn('{{%course}}','icon');
        $this->dropColumn('{{%course}}','price');
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m171206_053425_addColumnToCourse cannot be reverted.\n";

        return false;
    }
    */
}
